package console;

import java.awt.Graphics2D;
import java.awt.SplashScreen;

public class Splash implements Runnable {

    private SplashScreen splash;
    private Graphics2D g;
    private boolean splashRunning = false;

    public Splash() {
        splashRunning = false;
        splash = SplashScreen.getSplashScreen();
        if (splash == null) {
            return;
        }
        g = splash.createGraphics();
    }

    @Override
    public void run() {
        int i = 0;
        splashRunning = true;
        while (splashRunning) {
            if (g != null) {
                splash.update();
            }
            try {
                Thread.sleep(90);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            i++;
        }
    }

    public void stopSplash() {
        splashRunning = false;
    }
}
